package com.le.tester.leetcode;

/**
 * currentTime:2022/3/14 16:50
 * description:it is ugly 2,3,5
 */
public class Ugly {
    public boolean isUgly(int n) {
        if (n <= 0) {
            return false;
        }

        int[] factors = {2, 3, 5};
        for (int factor : factors) {
            while (n % factor == 0) {
                n /= factor;
                //n = n / factor;

            }
        }
        return n == 1;
    }

    public static void main(String[] args) {
        Ugly ugly = new Ugly();
        System.out.println(ugly.isUgly(15));
    }
}
